package com.jeeplus.modules.api.service;


import com.jeeplus.core.mapper.JsonMapper;
import com.jeeplus.core.service.BaseService;
import com.jeeplus.modules.sys.entity.Api;
import com.jeeplus.modules.tools.utils.MultiDBUtils;
import com.jeeplus.modules.tools.utils.SpringUtil;
import com.sun.javafx.collections.MappingChange;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author Administrator
 * @title: ApiService
 * @projectName jeeplus
 * @description: TODO
 * @date 2019/7/19:58
 */
@EnableAsync
@Service
@Transactional(readOnly = true)
public class ApiService extends BaseService {
    private JdbcTemplate jdbcTemplate;
    public ApiService(String beanDataSource){
        if(beanDataSource.isEmpty()){
            beanDataSource="db";
        }
        //jdbcTemplate=(JdbcTemplate) SpringUtil.getApplicationContext().getBean(beanDataSource);
    }
    @Async
    public List<Api> test() throws Exception {
        Api api=new Api();
        api.setId("test");
        System.out.println(getMap(api));
        Map<String,Object> map=new HashMap<>();
        map.put("test","test");
        System.out.println(map);
        return MultiDBUtils.get("zmjeep").queryList("select * from test",Api.class,null);
    }
}
